(define (double x) (+ x x))

(define (halve x) (/ x 2))

(define (even? n)
   (= (remainder n 2) 0))

(define (mul a b)
   (cond ((< b 0)(- (mul a (- b))))
         ((= b 0) 0)
         ((= b 1) a)
         ((even? b) (double (mul a (halve b))))
         (else (+ a (mul a (- b 1))))))